﻿using Emgu.CV;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WinCoreV3Run
{
    class MyTools
    {
        public static void WriteErrBmp(Mat src)
        {
            string path = MyParam.errPath;
            string date = getCurrentTime();
            path = path + MyParam.codeNumber + "_" + date + ".bmp";
            CvInvoke.Imwrite(path, src);
        }
        public static void WriteAllBmp(Mat src)
        {

            string path = MyParam.allPath;
            string date = getCurrentTime();
            path = path + MyParam.codeNumber + "_" + date + ".bmp";

            CvInvoke.Imwrite(path, src);
        }
        public static void WriteNullBmp(Mat src)
        {
            string path = MyParam.nullPath;
            string date = getCurrentTime();

            path = path + MyParam.codeNumber + "_" + date + ".bmp";

            CvInvoke.Imwrite(path, src);

        }
        public static string getCurrentTime()
        {
            DateTime now = System.DateTime.Now;
            string txtDate=now.ToString("yyyyMMddHHmmssffff");
            return txtDate;
        }
        public static void MoveBMP2Dir(string SrcPath, string destPath)
        {
            int index = SrcPath.LastIndexOf('\\');
            string name = SrcPath.Substring(index);
            name = destPath + name;
            File.Move(SrcPath, name);
        }
    }
}
